<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
	

	protected function _initAutoload() {
	
		date_default_timezone_set("Asia/Jakarta"); 
		
		$autoloader = new Zend_Application_Module_Autoloader(array( 
                    'namespace' => '', 
                    'basePath' => dirname(__FILE__), 
                )); 
                
	
		//var_dump($autoloader);
		
        return $autoloader; 
	}
	
	protected function _initResgisterConstant()
	{
		// Get the value of application.ini
		$configArray  = $this->getOptions();
		$this->config = new Zend_Config($configArray);
		$config       = $this->config;
		
		Zend_Registry::set('dbConfig', $config->resources->db);
		
		//Setup Database
		//var_dump($config->resources->db->params);
		$connect_db = Zend_Db::factory($config->resources->db->adapter, $config->resources->db->params);
		$connect_db->setFetchMode(Zend_Db::FETCH_ASSOC);
		$connect_db->query("SET NAMES 'utf8'");
	    $connect_db->query("SET CHARACTER SET 'utf8'");
	    Zend_Registry::set('connectDB', $connect_db);
		
		// Register the table prefix
		$tablePrefix 	= $config->resources->db->params->prefix;
		Zend_Registry::set('tablePrefix', $tablePrefix);
	}
	
	
	
	
	protected function _initCheckLogin(){
		$auth = Zend_Auth::getInstance();
    	$infoUser = $auth->getIdentity();
    	return (@$infoUser->username);
	}
	
}

?>